package com.gobuy.goods;

import com.gobuy.common.utils.IdWorker;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import tk.mybatis.spring.annotation.MapperScan;

/**
 * @author Gaozexi on 2020/6/2 19:13
 * Step by Step  and Stand on,  You Are The Best Investment!
 */

/**
 * 声明为Eureka客户端
 */
@EnableEurekaClient
@SpringBootApplication
/**
 * 扫描mapper包，使用的是BaseMapper,要导入tk路径下的包
 */
@MapperScan(basePackages = {"com.gobuy.goods.dao"})
public class GoodsApplication {
    @Value("${workId}")
    private int workId;

    @Value("${datacenterId}")
    private int datacenterId;

    public static void main(String[] args) {
        SpringApplication.run(GoodsApplication.class,args);
    }

    @Bean
    public IdWorker getIdWorker(){
        return new IdWorker(workId,datacenterId);
    }
}
